package cn.colins.consumer.filter;

import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.extension.Activate;
import org.apache.dubbo.rpc.Invocation;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.RpcException;
import org.apache.dubbo.rpc.cluster.LoadBalance;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

/**
 * @program: dubbo-annotation-study
 * @description:
 * @author: colins
 * @create: 2023-05-07 22:21
 **/
public class MyLoadBalance implements LoadBalance {

    private final static Logger log= LoggerFactory.getLogger(MyLoadBalance.class);


    @Override
    public <T> Invoker<T> select(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException {
        log.info("自定义负载均衡");
        return invokers.get(0);
    }
}
